/*
	封装定时器和计时器以及对应的清除两者的方法
*/
let timer = null // 定时器
let cdTimer = null // 计时器

export function mySetTimeOut (fn, delay) {
	timer = setTimeout(fn, delay)
	// console.log('timeout', timer)
}
export function myClearTimeOut () {
	// console.log('cleartimeout start', timer)
	// 这里暂停了 以防万一再赋值为null 以免数据紊乱
	clearTimeout(timer)
	timer = null
	// console.log('cleartimeout end', timer)
}

export function mySetInterval (fn, delay) {
	cdTimer = setInterval(fn, delay)
	// console.log('interval', cdTimer)
}
export function myClearInterval () {
	// console.log('clearinterval start', cdTimer)
	clearTimeout(cdTimer)
	cdTimer = null
	// console.log('clearinterval end', cdTimer)
}